/*FILE UPDATE INFO**************************************************************
 * Author   : PURESUN
 * Update   : 2023-02-14
 * Info     : PURESUN public function
 * Version  : 1.0.0
 ******************************************************************************/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __PURESUN_FUNCTION_H__
#define __PURESUN_FUNCTION_H__

/* Includes ------------------------------------------------------------------*/
#include "puresun_type.h"
#include "bsp_func_conf.h"
#ifndef __BSP_FUNC_CONF_H__
#include "bsp_func_conf_template.h"
#endif

/* Exported macro ------------------------------------------------------------*/

#ifdef MIN_MAX_FUNC
#define pf_min(a, b) (((a) < (b)) ? (a) : (b))
#define pf_max(a, b) (((a) > (b)) ? (a) : (b))
#endif

#define POLY_MODBUS 0x8005
/* Exported typedef -----------------------------------------------------------*/

/* Exported types ------------------------------------------------------------*/

/* Exported constants --------------------------------------------------------*/

/* Exported variables --------------------------------------------------------*/

/* Exported functions --------------------------------------------------------*/
void pf_to_upper(char *_ch);
void pf_to_lower(char *_ch);
void pf_to_lower_str(string str, uint16_t cnt_max);
void pf_to_upper_str(string str, uint16_t cnt_max);
bool_t pf_str_compare(string str1, string str2);
bool_t pf_char_is_num(char _ch);
int32_t pf_atoi(string str);
int64_t pf_atol(string str);
int pf_count_char_without_space_newline(byte *buff);
void pf_remove_space_tab_newline(byte *in, byte *out);
bool_t pf_str_is_number(string str);
uint16_t pf_crc16(byte const *p_data, int32_t data_len, uint16_t poly);
bool_t pf_file_exist(string file_path);

#endif //__PURESUN_FUNCTION_H__

/************************ (C) COPYRIGHT PURESUN *****END OF FILE***************/
